#ifndef __BSP_MPU6050_DRIVER_H
#define __BSP_MPU6050_DRIVER_H

#include "stdio.h"
#include "stdint.h"
#include "stdbool.h"

//上层硬件iic接口
typedef struct{
    int8_t (*pfiic_init)   (void);
    int8_t (*pfiic_deinit) (void);
    int8_t (*pfwrite_reg)  (uint16_t DevAddress, uint8_t *pData, uint16_t Size, uint32_t Timeout);
    int8_t (*pfread_reg)   (uint16_t DevAddress, uint8_t *pData, uint16_t Size, uint32_t Timeout);
}iic_driver_interface_t;

//中断接口
typedef struct{
    int8_t (*pfit_init)(void);    //设置分组,开启使能中断
    int8_t (*pfit_deinit)(void);  
    void (*pfcallback)(void)      //回调函数
}interuption_interface_t;

//集合结构体
typedef struct 
{
    //
    iic_driver_interface_t *iic_driver_interface;
    interuption_interface_t *interuption_interface;

    int8_t (*pfmpu_init)(void);
    int8_t (*pfmpu_deinit)(void);
    int8_t (*pfstart_work)(void);
    int8_t (*pfstop_work)(void);
    void   (*pfsleep)(void);
    void   (*pf_wakeup)(void);
    int8_t (*pfread_status)(void);  
    int8_t (*pfmpu_set_gyro_fsr)(uint8_t fsr);  //设置满量程范围
    int8_t (*pfmpu_set_accel_fsr)(uint8_t fsr); //设置数字低通滤波器
    int8_t (*pfmpu_set_lpf)(uint16_t lpf);      //设置低通滤波器
    int8_t (*pfmpu_set_rate)(uint16_t rate);    //设置采样率
    int8_t (*pfMPU_Get_Temperature)(uint8_t temp);//温度
    int8_t (*pfMPU_Get_Accelerometer)(int8_t *ax,int8_t *ay,int8_t *az);  //加速度
    int8_t (*pfMPU_Get_Gyroscope)(int8_t *gx,int8_t *gy,int8_t *gz)          //角速度(陀螺仪)

}bsp_mpu6050_driver_t;

//构造函数
int8_t inst_mpu6050_driver( bsp_mpu6050_driver_t    *bsp_mpu6050_driver,
                            iic_driver_interface_t  *iic_driver_interface,
                            interuption_interface_t *interuption_interface);
#endif